#pragma once
#include "LFEventHandler.h"
#include "Reactor.h"
#include "SOCK_Acceptor.h"

#include "LogEvent.h"
#include <vector>

#define MAX_LOGS 128

namespace Network 
{
	typedef struct LogListItem_
	{
		LogEvent event;
		time_t timestamp;

		LogListItem_(LogEvent event_, time_t timestamp_) : event(event_), timestamp(timestamp_) {} 
	} LogListItem;

	class LoggingEventHandler : public LFEventHandler
	{
		protected:
			SOCK_Stream peerStream;
			Reactor *reactor;
			bool status;
			std::vector<LogListItem> logs;

		public:
			LoggingEventHandler();
			LoggingEventHandler(const SOCK_Stream &stream);
			virtual void HandleEvent (HANDLE handle, EventType eventType);
			virtual HANDLE GetHandle();
			bool IsRunning();

			~LoggingEventHandler() {  } 

			//virtual std::string handle(unsigned char* data);
			//virtual SOCK_Acceptor getHandle() { return *listener; };
			//virtual EventType getType(){ return LOG_EVENT; }
	};
}

